const mysql = require("mysql")
const pool = mysql.createPool({
    host:"localhost",  
    user:"root",
    password:"myroot",
    database:"restaurant_list",
})
export default function sqlQuery(sqlStr){
    return new Promise((resolve,reject)=>{
        pool.getConnection(function(err,conn){
            if(err){
                reject(err)
            }else{
                conn.query(sqlStr,function(err,results,fields){
                    resolve(results)
                })
                conn.release();
            }
        })
    })
}
